home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NetNews Offline 2
/
NetNews Offline Volume 2.iso
/
news
/
comp
/
std
/
c
/
612
< prev
next >
Wrap
Internet Message Format
|
1996-08-06
|
3KB
Path: sundog.tiac.net!stanr
From: stanr@tiac.net (Stan Ryckman)
Newsgroups: comp.std.c
Subject: Re: Prefixing functions with return type..
Date: 20 Mar 1996 16:07:57 GMT
Organization: Amber & Sneakers Fan Club
Message-ID: <4ipagt$g53@sundog.tiac.net>
References: <4hstf8$jf3@cybernews.cyberus.ca> <1996Mar14.080731.15076@Watt.COM> <1996Mar18.201616.6958@Watt.COM>
NNTP-Posting-Host: sunspot.tiac.net
In article <1996Mar18.201616.6958@Watt.COM>,
Adrian P Stephens <aps@symbionics.co.uk> wrote:
:[ posted for aps@symbionics.com by steve@Watt.COM ]
[hope I got the attributions right]
:Love them or loath them, standards are important to any company. Ours
Agreed, but they need to be sensibly chosen.
:has "C" coding standards which require this kind of thing. Initially
:I was against it, because it makes things cluttered, lengthens lines
:of code and makes for more typing.
:
:Our standards also require explicit
:identification of the size returned if it is an integer. This is of
:benefit if you are doing emulation/debugging without a symbolic emulator/
:debugger (and how many do that??), but otherwise doesn't allow you to
I believe there are tools that can produce the type information you
need separately. Furthermore, if there are large numbers of names
in scope at most points, a design problem probably exists.
Also, it's a distinct anti-benefit if you need to type a debugger
command such as:
break at psTxManagementPktTXP_NewTxBeaconPkt
to set a breakpoint, for example.
:pretend you've got "opaque types" in "C". Also, for some things where
:the type is not selected until compile time (e.g. integer sizes and
:size_t particularly) you cannot select a name which is legal in the
:sense of these standards.
[snip]
:Here's an example from a bit of code I'm working on now:
:
:extern TX_MANAGEMENT_PKT * psTxManagementPktTXP_NewTxBeaconPkt(void);
:
:Elements required in our standard:
:
: TX_MANAGEMENT_PKT - all upper case because it's a typedef/struct
: p - pointer to ...
: sTxManagementPkt - a structure of this type (but case converted)
: TXP - name of module containing global export
: "NewTxBeaconPkt" - What I orginally called the routine before
: - I read our coding standards.
Standards like these sacrifice portabiliy, with what seems like
no benefit. (External identifiers, to be portable, must be unique in
the first six characters, independent of case.) It would seem to
me that if such names *must* be mandated (which I'm against), the
type information should be on the end, such as
NewTxBeaconPkt_psTxManagementPktTXP
(also probably more readable).
Also, do you need to rename everything if you change some typedef
from int to long? (or do the company standards forbid typedefs?)
Cheers,
Stan.
--
Stan Ryckman (stanr@tiac.net)
(Apologies for non-responses or late responses to some posts;
.newsrc was trashed and I'm trying to get it back to where it was.)